<template>
  <div class="app-container">
    <div style="width: 100%; height: auto; display: none" class="printContent">
      <div class="center size-24 title">{{ $t(`Print.RongyangMaterialPreparationWorkOrderManual`) }}</div>
      <table class="no-border">
        <tr>
          <td width="30%"></td>
          <td class="center size-16" width="30%">
            ({{ $t(`Print.DateOfPrinting`) }}:<span>{{ formatCurrentDate(currentDate) }}</span
            >)
          </td>
          <td class="size-16" width="30%">
            {{ $t(`Print.DispatchTicketNumber`) }}: <span>{{ printArr?.dispatchType }}</span>
          </td>
        </tr>
      </table>

      <div class="headerTable">
        <table class="no-border">
          <tr>
            <td class="size-16 left">{{ $t(`Print.DateOfManufacture`) }}:{{ printArr?.dispatchDate }}</td>
            <td class="size-16">{{ $t(`Print.Operator`) }}:{{ printArr?.workerName }}</td>
            <td class="size-16">{{ $t(`Print.Dispatchers`) }}:{{ printArr?.dispatchName }}</td>
            <td class="size-16 center" width="30%">
              {{ $t(`Print.SupplementaryOrderNumber`) }}:<span>{{ printArr?.dispatchDept }}</span>
            </td>
          </tr>
          <tr style="margin-top: 15px">
            <td class="size-16 left">{{ $t(`Print.Directives`) }}:{{ printArr?.lotNo }}</td>
            <td class="size-16">{{ $t(`Print.Body`) }}:{{ printArr?.style }}</td>
            <td class="size-16">{{ $t(`Print.Color`) }}:{{ printArr?.color }}</td>
            <td class="size-16 center">{{ $t(`Print.OrderVolume`) }}:{{ printArr?.orderQty }}</td>
            <td class="size-16">{{ $t(`Print.Rounds`) }}:{{ printArr?.lsNo }}</td>
          </tr>
        </table>
      </div>
      <div class="mainTable">
        <table style="text-align: center; font-size: 16px; margin-top: 10px">
          <tr v-for="item in printArr?.detail.value">
            <td class="size-16 center" v-for="item2 in item">{{ item2 }}</td>
          </tr>
        </table>
      </div>
    </div>

    <Find :OriginalFilter="{ static: true }" :formList="formList" @findClicked="findClicked" @Launchform="Launchform3" />

    <el-card style="margin-top: 10px" shadow="always" :body-style="{ padding: '5px' }">
      <div style="display: flex">
        <div style="width: 77%">
          <el-button type="primary" size="default" @click="dialogVisible8Methdos">{{ $t(`Print.InsertDispatchProfile`) }}</el-button>
          <el-button style="background-color: red" type="primary" size="default" @click="handleCloseMateriaLKlc as any">{{ $t(`Print.Delete`) }}</el-button>
          <h1 style="font-size: 15px; color: red">{{ $t(`Print.ToDeleteClickTheRowYouWantToDelete`) }}</h1>
          <Table
            @selectList="selectListq1"
            :selection="true"
            @download="download"
            :TableHeight="97"
            @currentRow="currentRow11"
            :tableHeader="tableHeader"
            :tableData="mainQueryTableDate"
            class="mt10"
            :isLoading="isLoading"
          />
          <PageModule :PageData="{ total, buttonS: true }" @pageSizeChange="handleSizeChange" @pageChange="handleCurrentChange" />
        </div>

        <div style="width: 20%; margin-left: 10px; margin-top: 32px">
          <h1 style="font-size: 15px">{{ $t(`Print.DispatchNumberDetails`) }}</h1>
          <Table :tableHeader="tableHeader1" :tableData="DispatchDetailQueryTableDate" class="mt10" :isLoading="isLoading1" />
        </div>
      </div>
    </el-card>

    <el-dialog :title="$t(`Print.DispatchOfSupplementaryOrders`)" v-model="dialogVisible8" width="80%" class="dialog pb0">
      <Find @Launchform="Launchform" :OriginalFilter="{ static: true }" :formList="formList1" :searchImg="false" @findClicked="findClicked1" />

      <div style="display: flex">
        <div style="width: 60%; margin-top: 44px">
          <div style="display: flex; width: 50%">
            <Find @Launchform="Launchform5" :OriginalFilter="{ static: true }" :formList="formList3" :searchImg="false" @findClicked="findClicked1" />
            <span style="margin-top: 15px; margin-left: 50px">{{ $t(`Print.TheNumberOfAssignedWorkers`) }}:{{ DispatchQuantity }}</span>
          </div>

          <el-table
            height="600px"
            :data="MakeyptheOrderMethodsTableDate"
            style="width: 100%; margin-bottom: 20px; margin-top: 7px"
            row-key="id"
            border
            default-expand-all
            @selection-change="handleSelectionChange"
            v-loading="loading"
          >
            <el-table-column type="selection" prop="1" label="" align="center" />
            <el-table-column prop="sizeNo" :label="$t(`Print.Instruction_Position_Number`)" align="center" />
            <el-table-column prop="qty" :label="$t(`Print._Process_Even`)" align="center" />
            <el-table-column prop="process" :label="$t(`Print.Even`)" align="center" />
          </el-table>
          <el-button style="margin: auto; display: block" type="primary" size="default" @click="DispatchAddMethods">{{ $t(`Print.InsertDispatcher`) }}</el-button>
        </div>

        <div style="width: 40%; margin-top: 20px; margin-left: 10px">
          <h1 style="font-size: 15px">{{ $t(`Print.ManualPersonnelInformationOfTheDay`) }}</h1>
          <Find @Launchform="Launchform1" :OriginalFilter="{ static: true }" :formList="formList2" :searchImg="false" @findClicked="findClicked1" />

          <el-table
            height="600px"
            :data="personalInformationMethodsTableDate"
            style="width: 100%; margin-bottom: 20px; margin-top: 7px"
            row-key="id"
            border
            default-expand-all
            @select="handleRowClick"
            ref="tableRef"
            class="A"
          >
            <el-table-column type="selection" label="" align="center" :selectable="(row:any) => !row.children" />
            <el-table-column prop="workerId" :label="$t(`Print.JobNumber`)" align="center" />
            <el-table-column prop="name" :label="$t(`Print.Employee`)" align="center" />
            <el-table-column prop="workType" :label="$t(`Print.JobCategory`)" align="center" />
          </el-table>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
<script lang="ts">
import { defineComponent, ref, onMounted, watch } from 'vue'
import JMessage from '@/utils/JMessage'
export default defineComponent({
  name: 'MakeOrderDispatch'
})
</script>
<script lang="ts" setup>
import { i18n, Jzhcn } from '@/i18n'
import {
  mainQuery,
  DispatchDetailQuery,
  personalInformation,
  TheOrderNumberIsDisplayed,
  ProcessEcho,
  sizeNoEcho,
  deletel,
  MakeyptheOrder,
  DispatchAdd,
  mainQuery1
} from '@/api/AccountingDepartment/ProductionDispatch/MakeOrderDispatch'
import LoginWork from '@/utils/LoginWork'
import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'

// 勾选删除
const selectListq1Parms = ref([])

const selectListq1 = (row: any) => {
  selectListq1Parms.value = row.map((item: any) => {
    return item
  })
}

const printArr = ref<any>()

const mainQuery1Parms = ref<any>()

const formatCurrentDate = (date?: any) => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  let newMonth = month > 10 ? month : '0' + month
  let newDay = day > 10 ? day : '0' + day
  return `${year}-${newMonth}-${newDay}`
}

const currentDate = ref(new Date())

const mainQuery1Methods = async () => {
  try {
    const result = await mainQuery1(mainQuery1Parms.value)
    if (result.code === 200) {
      printArr.value = result.data
      setTimeout(() => {
        const qrCodeContainer = document.querySelector<any>('.printContent')
        if (qrCodeContainer && printArr.value !== undefined) {
          qrCodeContainer.style.display = 'block'

          const printWindow = window.open('', '打印派工单')
          printWindow!.document.write(`
                <!DOCTYPE html>
                <html>
                    <head>
                    <title>打印指令领料作业</title>
                    <link rel="stylesheet" type="text/css" href="print.css" media="print">
                    <style>
                        body, html {
                        margin: 0;
                        padding: 0;
                        }
                        @page {
                        size: auto; 
                        margin: 3mm;
                        }
                        @media print {
                            /* 打印时的样式 */
                        
                            
                            /* 其他打印样式 */
                        }
                         h2 {
                    margin-left: initial; /* 或者设置适合打印的左边距 */
                    page-break-inside: avoid; /* 避免在h2元素内部分页 */
                }
            .headerTable {
                height: auto;
                border: 0px solid #000;
                text-align: center;
                display: flex;
                margin: 20px 20px 0px;
                vertical-align: top;
                width:100%
            }
            .title {
                display: flex;
                justify-content: center;
                margin-bottom: 10px;
            }

            .center {
                text-align: center;
            }

            .right {
                text-align: right;
            }

            .left {
                text-align: left;
            }

            .no-padding {
                padding: 0;
            }

            .no-margin {
                margin: 0;
            }

            .margin-5 {
                margin: 5px;
            }

            .margin-top-5 {
                margin-top: 5px;
            }

            .margin-top-15 {
                margin-top: 15px;
            }

            .size-8 {
                font-size: 8px !important;
            }

            .size-10 {
                font-size: 10px;
            }

            .size-12 {
                font-size: 12px;
            }

            .size-14 {
                font-size: 14px;
            }

            .size-16 {
                font-size: 17px;
            }

            .size-18 {
                font-size: 18px;
            }

            .size-24 {
                font-size: 24px;
            }

            #date-tip {
                position: relative;
            }

            span.tip {
                display: inline-block;
                height: 14px;
                line-height: 14px;
                margin-right: 30px;
            }

            table {
                font-size: 10px;
                border-collapse: collapse;
                border-spacing: 0;
                border-collapse: collapse;
                border-spacing: 0;
                empty-cells: show;
                width: 100%;
            }

            table th,
            table td {
                border: 1px solid #000;
                font-size: 12px;
            }

            table.no-border,
            table.no-border th,
            table.no-border td {
                border: 0px;
            }

            table td.no-left-border {
                border-left: 0px;
            }

            table td.no-right-border {
                border-right: 0px;
            }

            .mainTable {
                margin: 0 20px;
            }

            /* 备料派工单汇总表 */
            .header {
                display: flex;
                justify-content: space-evenly;
            }

            .footer {
                margin-top: 20px;
                margin-right: 100px;
                display: flex;
                justify-content: right;
            }
                    
                        /* 可以在这里添加更多自定义的打印样式 */
                    </style>
                    </head>
                    <body>
                `)

          // 将 .qrCodeContainer 的内容复制到打印窗口的 body 中
          const cloneContainer = qrCodeContainer.cloneNode(true)
          printWindow!.document.body.appendChild(cloneContainer)

          printWindow!.document.write(`
                    </body>
                </html>
                `)
          printWindow!.document.close()

          // 开始打印
          printWindow!.print()

          // 打印完成后，可以恢复 .qrCodeContainer 的原始显示状态
          qrCodeContainer.style.display = 'none'
        }
      }, 500)
    }
  } catch (error) {
    JMessage.error('打印数据查询出错')
  }
}

const download = async (row: any) => {
  mainQuery1Parms.value = row
  mainQuery1Methods()
}

// 派工新增
const DispatchAddParms = ref<any>({
  dispatchDate: '',
  name: '',
  slipNo: '',
  temps: [],
  workerId: '',
  workerIdNo: ''
})

const tableRef = ref<any>()

const handleRowClick = (selection: any, row: any) => {
  if (selection.length > 1) {
    let del_row = selection.shift()
    tableRef.value.toggleRowSelection(del_row, false)
    console.log(selection)
    DispatchAddParms.value.name = selection
      .map((item: any) => {
        return item.name
      })
      .join(',')
    DispatchAddParms.value.workerId = selection
      .map((item: any) => {
        return item.workerId
      })
      .join(',')
    DispatchAddParms.value.workerIdNo = selection
      .map((item: any) => {
        return item.workerIdNo
      })
      .join(',')
  } else {
    DispatchAddParms.value.name = selection
      .map((item: any) => {
        return item.name
      })
      .join(',')
    DispatchAddParms.value.workerId = selection
      .map((item: any) => {
        return item.workerId
      })
      .join(',')
    DispatchAddParms.value.workerIdNo = selection
      .map((item: any) => {
        return item.workerIdNo
      })
      .join(',')
  }
}

const DispatchAddMethods = async () => {
  if (DispatchAddParms.value.dispatchDate === '' || DispatchAddParms.value.workId === '' || DispatchAddParms.value.temps.length === 0) {
    JMessage.warning('生产日期和员工还有要分配的双数不可为空!')
  } else {
    try {
      console.log(DispatchAddParms.value)
      DispatchAddParms.value.temps.forEach((item:any) => {
        item.partName = item.partName.key
        return item
      })
      const result = await DispatchAdd(DispatchAddParms.value)
      if (result.code === 200) {
        MakeyptheOrderTableDate.value.sizeNo = []
        MakeyptheOrderMethods()
        mainQueryMethods()
        JMessage.success(result.message)
      } else {
        JMessage.error(result.message)
      }
    } catch (error) {
      JMessage.error('新增出错请重试')
    }
  }
}

// 派工表单查询
const MakeyptheOrderTableDate = ref({
  dispatchDate: '',
  process: [],
  sizeNo: [],
  slipNo: ''
})

// 派工数量
const DispatchQuantity = ref(0)

const handleSelectionChange = (row: any) => {
  DispatchQuantity.value = 0
  row.map((item: any) => {
    if (item.qty) {
      DispatchQuantity.value += item.qty
    }
    return item
  })
  DispatchAddParms.value.temps = row.filter((item: any) => {
    return !item.children
  })

  DispatchAddParms.value.temps = DispatchAddParms.value.temps.map((item: any) => {
    return item
  })
  formList3.value[0].selectValue1 = DispatchAddParms.value.temps.map((item: any) => {
    return item.sizeNo
  })
}

const MakeyptheOrderMethodsTableDate = ref<any>([])

const loading = ref(false)

const MakeyptheOrderMethods = async () => {
  loading.value = true
  try {
    const result = await MakeyptheOrder(MakeyptheOrderTableDate.value)

    let newObj: any = []

    let a = 0

    for (const key in result) {
      result['children'] = result[key]
      console.log(result)

      newObj.push({
        children: result[key],
        id: a++,
        sizeNo: key
      })
    }

    MakeyptheOrderMethodsTableDate.value = newObj.map((item: any) => {
      const newItem = { ...item } // 创建新对象避免直接修改原对象
      newItem.newChildren = [] // 创建一个新对象来存放修改后的键值对

      for (const key in newItem.children) {
        newItem.newChildren.push({
          children: newItem.children[key],
          id: a++,
          sizeNo: key
        })
      }

      newItem.children = newItem.newChildren // 使用新对象替换原对象中的键值对
      delete newItem.newChildren // 删除临时存储键值对的属性

      loading.value = false

      return newItem
    })
  } catch (error) {
    JMessage.error('派工表单查询出错')
    loading.value = false
  }
  loading.value = false
}

// 派工单删除
const deletelTableDate = ref()

const handleCloseMateriaLKlc = (_done?: () => void) => {
  if (selectListq1Parms.value.length === 0) {
    JMessage.warning('请勾选需要删除的数据')
  } else {
    ElMessageBox.confirm('确认要删除数据吗?')
      .then(async () => {
        deletelMethods()
      })
      .catch(() => {})
  }
}

const deletelMethods = async () => {
  try {
    const result = await deletel(selectListq1Parms.value)
    if (result.code === 200) {
      mainQueryMethods()
      JMessage.success(result.message)
    } else {
      JMessage.error(result.message)
    }
  } catch (error) {
    JMessage.error('删除出错请重试')
  }
}

// 号码回显
const sizeNoEchoMethods = async () => {
  try {
    const result = await sizeNoEcho(ProcessEchoParms.value.slipNo)
    formList3.value[0].selectOptions = EvaluatesTheArrayReturnValue(result)
  } catch (error) {
    JMessage.error('号码查询出错')
  }
}

const Launchform1 = (row: any) => {
  personalInformationParms.value = row[0].inputValue
  personalInformationMethods()
}

const personalInformationParms = ref('')

const personalInformationMethodsTableDate = ref<any>([])

const personalInformationMethods = async () => {
  const result = await personalInformation(personalInformationParms.value)

  let newObj = []

  let a = 0
  for (const key in result) {
    newObj.push({
      children: result[key],
      id: a++,
      workerId: key
    })
  }

  personalInformationMethodsTableDate.value = newObj
}

const formList = ref([
  {
    type: 'date',
    dateLabel: '生产日期',
    dateValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入指令',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入操作员',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '打印状态',
    selectLabel: '',
    selectOptions: [
      {
        optionKey: 1,
        optionValue: '全部',
        optionLabel: '全部'
      },
      {
        optionKey: 2,
        optionValue: '已打印',
        optionLabel: '已打印'
      },
      {
        optionKey: 3,
        optionValue: '未打印',
        optionLabel: '未打印'
      }
    ]
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  }
])

// 工艺查询
const ProcessEchoParms = ref({
  slipNo: '',
  process: ''
})

const Launchform = (row: any) => {
  ProcessEchoParms.value.slipNo = row[1].selectValue
  MakeyptheOrderTableDate.value.slipNo = row[1].selectValue
  DispatchAddParms.value.dispatchDate = row[0].dateValue
  DispatchAddParms.value.slipNo = row[1].selectValue

  MakeyptheOrderTableDate.value.process = row[2].selectValue1
}

const Launchform5 = (row: any) => {
  MakeyptheOrderTableDate.value.sizeNo = row[0].selectValue1
}

watch(ProcessEchoParms.value, (oldValue, newValue) => {
  ProcessEchoMethods()
  sizeNoEchoMethods()
})

const findClicked1 = (row: any) => {
  if (row === '搜索') {
    if (ProcessEchoParms.value.slipNo !== '') {
      MakeyptheOrderMethods()
    } else {
      JMessage.warning('补单号不可为空')
    }
  }
}

const ProcessEchoMethods = async () => {
  // JMessage.warning('工艺下拉框和号码下拉框数据加载中请稍后......')
  try {
    const result = await ProcessEcho(ProcessEchoParms.value.slipNo, ProcessEchoParms.value.process)
    formList1.value[2].selectOptions = EvaluatesTheArrayReturnValue1(result)
    // JMessage.success('工艺下拉框和号码下拉框数据加载完成!')
  } catch (error) {
    JMessage.error('工艺查询出错')
  }
}
const EvaluatesTheArrayReturnValue1 = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      optionKey: index,
      optionValue: item,
      optionLabel: item
    }
  })
}
const handleSizeChange1 = (val: number) => {
  TheOrderNumberIsDisplayedParms.value.pageSize = val
  TheOrderNumberIsDisplayedMethdos()
}
const handleCurrentChange1 = (val: number) => {
  TheOrderNumberIsDisplayedParms.value.pageNum = val
  TheOrderNumberIsDisplayedMethdos()
}

const totalLo = ref(0)

const formList1 = ref([
  {
    type: 'dateSingle',
    dateLabel: '生产日期',
    dateValue: ''
  },
  {
    type: 'selectJ',
    selectValue: '',
    selectP: '选择补单号',
    selectLabel: '',
    selectOptions: [],
  },
  {
    type: 'select1',
    selectValue: '',
    selectP: '工艺',
    selectLabel: '',
    selectOptions: []
  },
  {
    type: 'button',
    checkboxLabel: '搜索'
  }
])

const formList2 = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入冲工',
    inputValue: '',
    inputLabel: ''
  }
])

const formList3 = ref<any>([
  {
    type: 'select1',
    selectValue: '',
    selectP: '号码',
    selectLabel: '',
    selectOptions: []
  }
])

// 补单号回显
const TheOrderNumberIsDisplayedParms = ref({
  pageNum: 1,
  pageSize: 9999
})

const TheOrderNumberIsDisplayedMethdos = async () => {
  try {
    const result = await TheOrderNumberIsDisplayed(TheOrderNumberIsDisplayedParms.value)
    formList1.value[1].selectOptions = EvaluatesTheArrayReturnValue(result.slipNos)
    totalLo.value = result.total
  } catch (error) {
    JMessage.error('补单号查询出错')
  }
}

const EvaluatesTheArrayReturnValue = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      value: item,
      label: item
    }
  })
}

const dialogVisible8 = ref(false)

// 插入派工资料
const dialogVisible8Methdos = () => {
  personalInformationMethods()
  TheOrderNumberIsDisplayedMethdos()
  dialogVisible8.value = true
}

// 派工明细号码查询
const DispatchDetailQueryParms = ref({
  dispatchDate: '',
  dispatchType: '',
  lotNo: '',
  partName: '',
  workerIdNo: ''
})

const currentRow11 = (row: any) => {
  DispatchDetailQueryParms.value.dispatchDate = row.dispatchDate
  DispatchDetailQueryParms.value.dispatchType = row.dispatchType
  DispatchDetailQueryParms.value.lotNo = row.lotNo
  DispatchDetailQueryParms.value.partName = row.partName
  DispatchDetailQueryParms.value.workerIdNo = row.workerIdNo
  DispatchDetailQueryMethdos()

  deletelTableDate.value = row
}

const isLoading1 = ref(false)

const DispatchDetailQueryTableDate = ref([])

const DispatchDetailQueryMethdos = async () => {
  isLoading1.value = true
  try {
    const result = await DispatchDetailQuery(DispatchDetailQueryParms.value)
    DispatchDetailQueryTableDate.value = result
    isLoading1.value = false
  } catch (error) {
    JMessage.warning('派工号码明细查询出错')
    isLoading1.value = false
  }
}

const mainQueryParms = ref({
  dispatchEnd: '',
  dispatchStart: '',
  lotNo: '',
  ordName: '',
  ordType: '',
  pageNum: 1,
  pageSize: 40,
  printFlag: '',
  workerName: ''
})

const Launchform3 = (row: any) => {
  mainQueryParms.value.dispatchStart = row[0].dateValue[0]
  mainQueryParms.value.dispatchEnd = row[0].dateValue[1]
  mainQueryParms.value.lotNo = row[1].inputValue
  mainQueryParms.value.workerName = row[2].inputValue
  mainQueryParms.value.printFlag = row[3].selectValue
  if (mainQueryParms.value.printFlag === '已打印') {
    mainQueryParms.value.printFlag = 'Y'
  }
  if (mainQueryParms.value.printFlag === '未打印') {
    mainQueryParms.value.printFlag = 'N'
  }

  if (mainQueryParms.value.printFlag === '全部') {
    mainQueryParms.value.printFlag = ''
  }
  mainQueryMethods()
}

onMounted(() => {
  mainQueryMethods()
})

const mainQueryTableDate = ref([])

const isLoading = ref(false)

const mainQueryMethods = async () => {
  isLoading.value = true
  try {
    const result = await mainQuery(mainQueryParms.value)
    mainQueryTableDate.value = result.dtos.map((item:any) => {
      item.partName1 = item.partName.value
      item.partName = item.partName.key
      return item
    })
    if (result.dtos.length !== 0) {
      DispatchDetailQueryParms.value.dispatchDate = result.dtos[0].dispatchDate
      DispatchDetailQueryParms.value.dispatchType = result.dtos[0].dispatchType
      DispatchDetailQueryParms.value.lotNo = result.dtos[0].lotNo
      DispatchDetailQueryParms.value.partName = result.dtos[0].partName
      DispatchDetailQueryParms.value.workerIdNo = result.dtos[0].workerIdNo
      DispatchDetailQueryMethdos()
    }
    total.value = result.total
    isLoading.value = false
  } catch (error) {
    JMessage.error('数据查询出错')
    isLoading.value = false
  }
}

const total = ref(0)

const handleSizeChange = (val: number) => {
  mainQueryParms.value.pageSize = val
  mainQueryMethods()
}

const handleCurrentChange = (val: number) => {
  mainQueryParms.value.pageNum = val
  mainQueryMethods()
}

const findClicked = (count: string) => {
  if (count === '置空') {
    formList.value.forEach((item: any) => {
      item.inputValue = ''
      item.dateValue = ''
      item.selectValue = ''
    })
  }
}

const tableHeader = ref([
  {
    width: '120px',
    label: '生产日期',
    prop: 'dispatchDate'
  },
  {
    label: '指令号',
    prop: 'lotNo'
  },
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '工序部位',
    prop: 'partName1'
  },
  {
    label: '操作人员',
    prop: 'workerName'
  },
  {
    label: '开始轮数',
    prop: 'lsNo'
  },
  {
    label: '截止轮数',
    prop: 'lsNo2'
  },
  {
    label: '派工数量',
    prop: 'dispatchQty'
  },
  {
    label: '派工人员',
    prop: 'dispatchName'
  },
  {
    width: '120px',
    label: '派工标签',
    prop: 'dispatchType'
  },
  {
    width: '120px',
    label: '补单号',
    prop: 'dispatchDept'
  },
  {
    label: '派工单打印',
    prop: 'printFlag'
  },
  {
    width: '120px',
    type: 'function',
    label: '操作',
    prop: [{ label: '打印派工单', bgColor: '#1C84C6' }]
  }
])

const tableHeader1 = ref([
  {
    label: '号码',
    prop: 'sizeNo'
  },
  {
    label: '派工量',
    prop: 'qty'
  }
])
</script>

<style scoped>
:deep(.el-table__cell) {
  color: black !important;
}

:deep(.A.el-table th.el-table__cell:nth-child(1) .cell) {
  visibility: hidden;
}

.qrCodeContainer {
  display: none;
}

.headerTable {
  height: auto;
  border: 0px solid #000;
  text-align: center;
  display: flex;
  margin: 20px 20px 0px;
  vertical-align: top;
}

.title {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.center {
  text-align: center;
}

.right {
  text-align: right;
}

.left {
  text-align: left;
}

.no-padding {
  padding: 0;
}

.no-margin {
  margin: 0;
}

.margin-5 {
  margin: 5px;
}

.margin-top-5 {
  margin-top: 5px;
}

.margin-top-15 {
  margin-top: 15px;
}

.size-8 {
  font-size: 8px !important;
}

.size-10 {
  font-size: 10px;
}

.size-12 {
  font-size: 12px;
}

.size-14 {
  font-size: 14px;
}

.size-16 {
  font-size: 17px;
}

.size-18 {
  font-size: 18px;
}

.size-24 {
  font-size: 24px;
}

#date-tip {
  position: relative;
}

span.tip {
  display: inline-block;
  height: 14px;
  line-height: 14px;
  margin-right: 30px;
}

table {
  font-size: 10px;
  border-collapse: collapse;
  border-spacing: 0;
  border-collapse: collapse;
  border-spacing: 0;
  empty-cells: show;
  width: 100%;
}

table th,
table td {
  border: 1px solid #000;
  font-size: 12px;
}

table.no-border,
table.no-border th,
table.no-border td {
  border: 0px;
}

table td.no-left-border {
  border-left: 0px;
}

table td.no-right-border {
  border-right: 0px;
}

.mainTable {
  margin: 0 20px;
}

/* 备料派工单汇总表 */
.header {
  display: flex;
  justify-content: space-evenly;
}

.footer {
  margin-top: 20px;
  margin-right: 100px;
  display: flex;
  justify-content: right;
}
</style>
